#! /usr/bin/env python

PACKAGE='color_classifier'
import roslib; roslib.load_manifest(PACKAGE)

from math import pi

from driver_base.msg import SensorLevels
from dynamic_reconfigure.parameter_generator import *

gen = ParameterGenerator()
#Name            Type   Reconfiguration level             Description         Default Min Max
gen.add( "red_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "red filter enabled", False)
gen.add( "red_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "red hue mean",   0.0,   0.0, 180.0 )
gen.add( "red_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "red sat mean",   255.0, 0.0, 255.0 )
gen.add( "red_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "red val mean",   255.0, 0.0, 255.0 )
gen.add( "red_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "red threshold",  0.0,   0.0, 1.0 )
gen.add( "red_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "red hue var",    0.0,   0.0, 5000.0 )
gen.add( "red_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "red sat var",    0.0,   0.0, 5000.0 )
gen.add( "red_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "red val var",    0.0,   0.0, 5000.0 )
#gen.add( "red_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "red hue weight", 0.5,   0.0, 1.0 )
#gen.add( "red_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "red sat weight", 0.5,   0.0, 1.0 )
#gen.add( "red_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "red val weight", 0.5,   0.0, 1.0 )

gen.add( "orange_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "orange filter enabled", False)
gen.add( "orange_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "orange hue mean",   15.0,  0.0, 180.0 )
gen.add( "orange_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "orange sat mean",   255.0, 0.0, 255.0 )
gen.add( "orange_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "orange val mean",   255.0, 0.0, 255.0 )
gen.add( "orange_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "orange threshold",  0.0,   0.0, 1.0 )
gen.add( "orange_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "orange hue var",    0.0,   0.0, 5000.0 )
gen.add( "orange_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "orange sat var",    0.0,   0.0, 5000.0 )
gen.add( "orange_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "orange val var",    0.0,   0.0, 5000.0 )
#gen.add( "orange_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "orange hue weight", 0.5,   0.0, 1.0 )
#gen.add( "orange_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "orange sat weight", 0.5,   0.0, 1.0 )
#gen.add( "orange_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "orange val weight", 0.5,   0.0, 1.0 )

gen.add( "yellow_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "yellow filter enabled", False)
gen.add( "yellow_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow hue mean",   30.0,  0.0, 180.0 )
gen.add( "yellow_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow sat mean",   255.0, 0.0, 255.0 )
gen.add( "yellow_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow val mean",   255.0, 0.0, 255.0 )
gen.add( "yellow_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow threshold",  0.0,   0.0, 1.0 )
gen.add( "yellow_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow hue var",    0.0,   0.0, 5000.0 )
gen.add( "yellow_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow sat var",    0.0,   0.0, 5000.0 )
gen.add( "yellow_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow val var",    0.0,   0.0, 5000.0 )
#gen.add( "yellow_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow hue weight", 0.5,   0.0, 1.0 )
#gen.add( "yellow_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow sat weight", 0.5,   0.0, 1.0 )
#gen.add( "yellow_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "yellow val weight", 0.5,   0.0, 1.0 )

gen.add( "green_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "green filter enabled", False)
gen.add( "green_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "green hue mean",   60.0,  0.0, 180.0 )
gen.add( "green_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "green sat mean",   255.0, 0.0, 255.0 )
gen.add( "green_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "green val mean",   255.0, 0.0, 255.0 )
gen.add( "green_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "green threshold",  0.0,   0.0, 1.0 )
gen.add( "green_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "green hue var",    0.0,   0.0, 5000.0 )
gen.add( "green_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "green sat var",    0.0,   0.0, 5000.0 )
gen.add( "green_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "green val var",    0.0,   0.0, 5000.0 )
#gen.add( "green_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "green hue weight", 0.5,   0.0, 1.0 )
#gen.add( "green_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "green sat weight", 0.5,   0.0, 1.0 )
#gen.add( "green_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "green val weight", 0.5,   0.0, 1.0 )

gen.add( "blue_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "blue filter enabled", False)
gen.add( "blue_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "blue hue mean",   120.0, 0.0, 180.0 )
gen.add( "blue_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "blue sat mean",   255.0, 0.0, 255.0 )
gen.add( "blue_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "blue val mean",   255.0, 0.0, 255.0 )
gen.add( "blue_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "blue threshold",  0.0,   0.0, 1.0 )
gen.add( "blue_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "blue hue var",    0.0,   0.0, 5000.0 )
gen.add( "blue_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "blue sat var",    0.0,   0.0, 5000.0 )
gen.add( "blue_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "blue val var",    0.0,   0.0, 5000.0 )
#gen.add( "blue_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "blue hue weight", 0.5,   0.0, 1.0 )
#gen.add( "blue_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "blue sat weight", 0.5,   0.0, 1.0 )
#gen.add( "blue_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "blue val weight", 0.5,   0.0, 1.0 )

gen.add( "black_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "black filter enabled", False)
gen.add( "black_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "black hue mean",   0.0,   0.0, 180.0 )
gen.add( "black_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "black sat mean",   255.0, 0.0, 255.0 )
gen.add( "black_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "black val mean",   255.0, 0.0, 255.0 )
gen.add( "black_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "black threshold",  0.0,   0.0, 1.0 )
gen.add( "black_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "black hue var",    0.0,   0.0, 5000.0 )
gen.add( "black_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "black sat var",    0.0,   0.0, 5000.0 )
gen.add( "black_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "black val var",    0.0,   0.0, 5000.0 )
#gen.add( "black_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "black hue weight", 0.5,   0.0, 1.0 )
#gen.add( "black_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "black sat weight", 0.5,   0.0, 1.0 )
#gen.add( "black_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "black val weight", 0.5,   0.0, 1.0 )

gen.add( "white_filter_enabled", bool_t,   SensorLevels.RECONFIGURE_RUNNING, "white filter enabled", False)
gen.add( "white_hue",            double_t, SensorLevels.RECONFIGURE_RUNNING, "white hue mean",   0.0,   0.0, 180.0 )
gen.add( "white_sat",            double_t, SensorLevels.RECONFIGURE_RUNNING, "white sat mean",   255.0, 0.0, 255.0 )
gen.add( "white_val",            double_t, SensorLevels.RECONFIGURE_RUNNING, "white val mean",   255.0, 0.0, 255.0 )
gen.add( "white_threshold",      double_t, SensorLevels.RECONFIGURE_RUNNING, "white threshold",  0.0,   0.0, 1.0 )
gen.add( "white_hue_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "white hue var",    0.0,   0.0, 5000.0 )
gen.add( "white_sat_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "white sat var",    0.0,   0.0, 5000.0 )
gen.add( "white_val_variance",   double_t, SensorLevels.RECONFIGURE_RUNNING, "white val var",    0.0,   0.0, 5000.0 )
#gen.add( "white_hue_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "white hue weight", 0.5,   0.0, 1.0 )
#gen.add( "white_sat_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "white sat weight", 0.5,   0.0, 1.0 )
#gen.add( "white_val_weight",     double_t, SensorLevels.RECONFIGURE_RUNNING, "white val weight", 0.5,   0.0, 1.0 )

gen.add( "ms_spatial_radius", double_t, SensorLevels.RECONFIGURE_RUNNING,"MS spatial-radius", 1.0, 0.0, 100.0)
gen.add( "ms_color_radius", double_t, SensorLevels.RECONFIGURE_RUNNING,"MS color-radius", 10.0, 0.0, 100.0)
gen.add( "ms_max_level", int_t, SensorLevels.RECONFIGURE_RUNNING,"MS max level", 2, 0, 4)
gen.add( "ms_max_iter", int_t, SensorLevels.RECONFIGURE_RUNNING,"MS max iter", 3, 0, 10)
gen.add( "ms_min_epsilon", double_t, SensorLevels.RECONFIGURE_RUNNING,"MS min epsilon", 1.0, 0.0, 100.0)

gen.add( "enable_meanshift", bool_t, SensorLevels.RECONFIGURE_RUNNING,"enable meanshift", False)

gen.add( "open_iterations", int_t, SensorLevels.RECONFIGURE_RUNNING, "open iterations", 1, 0, 10 )
gen.add( "close_iterations", int_t, SensorLevels.RECONFIGURE_RUNNING, "close iterations", 1, 0, 10 )

exit(gen.generate(PACKAGE, "dynamic_reconfigure_node", "ColorClassifier"))

